package gui;

import javax.swing.*;
import javax.swing.table.JTableHeader;
import java.awt.event.MouseEvent;

/**
 * @author dotekien
 *         Date: Apr 11, 2006
 *         Time: 5:42:50 PM
 */
public class SameTable extends JTable {
    String[] columnToolTips;

    public void setcolumnToolTips(String[] columnToolTips) {
        this.columnToolTips = columnToolTips;
    }

    protected JTableHeader createDefaultTableHeader() {
        return new JTableHeader(columnModel) {
            public String getToolTipText(MouseEvent e) {
                java.awt.Point p = e.getPoint();
                int index = columnModel.getColumnIndexAtX(p.x);
                int realIndex =
                        columnModel.getColumn(index).getModelIndex();
                return columnToolTips[realIndex];
            }
        };
    }
}
